package lunsfordhall.androidapp;

import android.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AdapterView.OnItemClickListener;

public class AlgebraFormulas extends ListActivity{
	private String[] formulas2 = {"Quadratic Formula"};
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        setListAdapter(new ArrayAdapter<String>(this, R.layout.simple_list_item_1, formulas2));
        
getListView().setOnItemClickListener(new OnItemClickListener() {	 
            
			public void onItemClick(AdapterView<?> parent, View view, int position,
					long id) {
				Intent showIntent = null;
				
				 if(position == 0){
					  showIntent = new Intent(getApplicationContext(),quadraticformula.class);
				 }
				 
				 
				 else{
					 System.out.println("Hello");
				 }
				 
				 startActivity(showIntent);
			}		
        });
    
    }
	
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    super.onKeyDown(keyCode, event);
	    if(keyCode == KeyEvent.KEYCODE_BACK){
	    	finish();
	    	return true;
	    }
	    else return false;
}
}